package cn.funeralobjects.asms.converter;

import cn.funeralobjects.utils.aliyun.sms.enums.SignStatus;

import javax.persistence.AttributeConverter;

/**
 * Converter of SignStatus
 *
 * @author FuneralObjects
 * Create date: 2020/5/31 5:36 PM
 */
public class SignStatusConverter implements AttributeConverter<SignStatus, Short> {
    @Override
    public Short convertToDatabaseColumn(SignStatus attribute) {
        return attribute == null ? null : attribute.getNum();
    }

    @Override
    public SignStatus convertToEntityAttribute(Short dbData) {
        return dbData == null ? SignStatus.OTHER : SignStatus.of(dbData);
    }
}
